package com.yfs.cloud.entity;

import javax.persistence.*;
import javax.validation.constraints.NotEmpty;

import org.hibernate.validator.constraints.Length;

import com.yfs.cloud.annotation.Phone;

import io.swagger.annotations.ApiModelProperty;

@Table(name = "tb_users")
public class User extends BaseEntity {

	// 其实确切讲, 这其实是账户名, 也就是 loginAccount, 即不能重复的. 因为常见的数据库设计是有账号和用户名, 用户名可以重复,
	// 但是账号唯一, 用户名其实类似于昵称这样的东西
	@NotEmpty(message = "用户名不能为空")
	@Length(min = 6, max = 12, message = "用户名长度需要介于6到12位之间")
	@ApiModelProperty(value = "用户名")
	private String username;

	@NotEmpty(message = "密码不能为空")
	@Length(min = 6, message = "密码长度不能小于6位")
	@ApiModelProperty(value = "密码")
	private String password;

	@ApiModelProperty(value = "性别 0 = 女 1 = 男")
	private Byte sex;

	@ApiModelProperty(value = "手机号")
	@Phone
	private String phone;

	@ApiModelProperty(value = "微信openid")
	@Column(name = "openid")
	private String openId;

	@ApiModelProperty(value = "微信昵称")
	@Column(name = "wx_nickname")
	private String wxNickName;

	@ApiModelProperty(value = "微信头像url")
	@Column(name = "wx_avatar")
	private String wxAvatar;

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Byte getSex() {
		return sex;
	}

	public void setSex(Byte sex) {
		this.sex = sex;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

	public String getWxNickName() {
		return wxNickName;
	}

	public void setWxNickName(String wxNickName) {
		this.wxNickName = wxNickName;
	}

	public String getWxAvatar() {
		return wxAvatar;
	}

	public void setWxAvatar(String wxAvatar) {
		this.wxAvatar = wxAvatar;
	}

}